package com.qst.financing.service.serviceImpl;

import com.qst.financing.mapper.BankMapper;
import com.qst.financing.pojo.Bank;
import com.qst.financing.service.BankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BankServiceImpl implements BankService {
    @Autowired
    private BankMapper BankMapper;

    @Override
    public List<Bank> selectAllBank() {

        UserDetails principal = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        String name = principal.getUsername();

        List<Bank> banks = BankMapper.selectAllBank();

        return banks;
    }
    @Override
    public String selectBankName(Integer bankid) {
        return BankMapper.selectBankName(bankid);
    }

}
